package com.pet_service.controller;

import com.pet_service.result.Result;
import com.pet_service.service.BookingService;
import com.pet_service.vo.BookingRequestDTO;
import com.pet_service.vo.BookingResponseVO;
import com.pet_service.vo.PageBean;
import com.pet_service.vo.PageResultVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 邹全伸
 * @version 1.0
 * @date 2025-10-03 14:42
 */
//预约控制器
@RestController
@RequestMapping("/booking")
@Slf4j
@Tag(name = "预约管理")
public class BookingController {
    @Resource
    private BookingService bookingService;

    // 分页查询预约列表
    @GetMapping("/list")
    @Operation(summary = "分页查询预约列表")
    @PreAuthorize("hasAuthority('staff:booking:view')")
    public Result<PageResultVO<BookingResponseVO>> listBookings(
            @RequestParam Integer pageNum,
            @RequestParam Integer pageSize,
            @RequestParam(required = false) Integer serviceType) {
        PageBean pageBean = new PageBean(pageNum, pageSize);
        PageResultVO<BookingResponseVO> result = bookingService.listBookings(pageBean, serviceType);
        return Result.ok(result);
    }
}

